const { getThemeVariables } = require('antd/dist/theme');
const CracoLessPlugin = require('craco-less');
const path = require('path')

const pathResolve = pathUrl => path.join(__dirname, pathUrl)
module.exports = {
  webpack: {
    alias: {
      // '@@': pathResolve('.'),
      '@': pathResolve('src'),
      '@assets': pathResolve('src/assets'),
      '@components': pathResolve('src/components'),
      // '@hooks': pathResolve('src/hooks'),
      // '@pages': pathResolve('src/pages'),
      // '@store': pathResolve('src/store'),
      // '@utils': pathResolve('src/utils')
      // '@common': pathResolve('src/common'),
      // 此处是一个示例，实际可根据各自需求配置
    },
    extensions:['js','tsx']
  },
  plugins: [
    {
      plugin: CracoLessPlugin,
      options: {
        lessLoaderOptions: {
          lessOptions: {
            modifyVars: getThemeVariables({
              // dark: true, // 开启暗黑模式
              // compact: true, // 开启紧凑模式
            }),
            javascriptEnabled: true,
          },
        },
      },
    },
  ],
};